package controller;

import java.util.logging.SimpleFormatter;

@WebServlet( name = "UserAddServlet", urlPATTERNS = "/UseresAddServlet")

public class UserAddServlet {

    @WebServlet( name = "UsersServlet", urlPATTERNS = "/UseresServlet")
    public class UsersAddServlet extends  HttpServlet {

)


            protected  void  doPost )HttpservletRequest request, HttpServletResponse response) throws SerletException{
       try{

       }catch (Exception e){
           e.printStackTrace();
       }
//获取数据
        String username = request.getParameter("s:"username");
        int age = Integer.parseInt(request.getParameter(s:"age"));
        Date birth = new SimpleFormatter(pattern:"yyyy-MM-dd").parse(request.getParameter(s:"birth"));
        Users user = new Users();
        users.setUserbane(username);
        user.setAge(age);
        user.setBirth(birth);

        //调用userdao的保存方法保存输出
        U色弱D奥到= new UserDao();
        dao.save(user);

        requewt.getRequestDispatcher(s:"/UsersServlet").forward(request.response);

            }
            protected  void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException
                doPost(request,respone);
    }
}
